const path = require('path');

// process.env.NODE_ENV
module.exports = {
    name: 'hahahah',
    mode: 'none',
    target: 'es5',
    entry: './src/main.js',
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'bundle.[chunkhash:8].js',
    },
    module: {
        rules: [
            {
                test: /\.(js|jsx)$/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: [
                            ['@babel/preset-env', { targets: "ie >= 8" }]
                        ],
                        "plugins": [
                            // ["@babel/plugin-transform-runtime"]
                            ["@babel/plugin-transform-arrow-functions"]
                        ]
                    }
                },
                // exclude: '/node_modules/'
            },
            {
                test: /\.(png|jpg|gif)$/i,
                use: [
                    {
                        loader: 'url-loader',
                        options: {
                            name: "[name].[contenthash:8].[ext]",
                            limit: 5*1024,// 小于该值则转成base64
                            esModule: false,
                        },
                    },
                ],
            },
            
            {
                test: /\.(less|css)$/,
                use: [
                    "style-loader",
                    "css-loader",
                    "less-loader",
                ],
            },
            {
                test: /\.vue$/,
                use: [
                    'vue-loader',
                ]
            }
        ],
    },
};